<?
include 'db_info.php';

// create team data table
$query_string = "CREATE TABLE team 
(
id INT(10) NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(id),
teamname VARCHAR(20) NOT NULL,
teampw VARCHAR(20) NOT NULL,
vocal VARCHAR(20) NOT NULL,
first VARCHAR(20) NOT NULL,
second VARCHAR(20) NOT NULL,
bass VARCHAR(20) NOT NULL,
drum VARCHAR(20) NOT NULL,
keyboard VARCHAR(20) NOT NULL,
others TEXT NOT NULL
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='합주팀 정보' ";
$query = mysqli_query($connect, $query_string);

// create time data table
$query_string = "CREATE TABLE team_time
(
id INT(10) NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
teamname VARCHAR(20) NOT NULL,
monday_start INT(10) NOT NULL,
monday_end INT(10) NOT NULL,
tuesday_start INT(10) NOT NULL,
tuesday_end INT(10) NOT NULL,
wednesday_start INT(10) NOT NULL,
wednesday_end INT(10) NOT NULL,
thursday_start INT(10) NOT NULL,
thursday_end INT(10) NOT NULL,
friday_start INT(10) NOT NULL,
friday_end INT(10) NOT NULL,
saturday_start INT(10) NOT NULL,
saturday_end INT(10) NOT NULL,
sunday_start INT(10) NOT NULL,
sunday_end INT(10) NOT NULL
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='팀 시간 사용 정보'";
$query = mysqli_query($connect, $query_string);

// create timetable
$query_string = "CREATE TABLE timetable
(
time VARCHAR(4) NOT NULL,
PRIMARY KEY(time),
monday VARCHAR(20) NOT NULL,
tuesday VARCHAR(20) NOT NULL,
wednesday VARCHAR(20) NOT NULL,
thursday VARCHAR(20) NOT NULL,
friday VARCHAR(20) NOT NULL,
saturday VARCHAR(20) NOT NULL,
sunday VARCHAR(20) NOT NULL
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='시간표 출력'";
$query = mysqli_query($connect, $query_string);

// initialize timetable
for ($counter = 900; $counter < 2400; $counter += 50) {
	$query_string = "INSERT INTO `timetable` VALUES('$counter', '', '', '', '', '', '', '')";
	$query = mysqli_query($connect, $query_string);
}
?>